//Komissarov Denis
package GUI;

import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class CDrawPanel extends JPanel {
	
	private static final long serialVersionUID = 1L;
	
	ImageIcon img;
	ImageIcon imgToDraw;
	int imgTop;
	int imgLeft;
	
    //========================================= constructor
    public CDrawPanel () {
    	
    }
    
    public CDrawPanel (ImageIcon img_) {
        img = img_;
    }
       
    //====================================== paintComponent
    public void draw(ImageIcon img, int top, int left) {
    	imgToDraw = img;
    	imgTop = top;
    	imgLeft = left;
    }
    
    @Override public void paintComponent(Graphics g) {
		super.paintComponent(g);
		img.paintIcon(this, g, 0, 0);
		
		if (imgToDraw != null)
			imgToDraw.paintIcon(this, g, imgTop, imgLeft);
    }
 
}
